#!/usr/bin/ruby
# Author: Foung Vang
# Assignment: Advanced

class MathDojo
	attr_reader :sum
	
	def initialize()
		@sum = 0
	end

	def add(*nums)
		nums.flatten!
		nums.each { |a| @sum += a }
		self
	end

	def subtract(*nums)
		nums.flatten!
		nums.each { |a| @sum -= a }

		self
	end
end

puts calculate = MathDojo.new.add(1).add([3, 5, 7, 8], [2, 4.3, 1.25]).subtract([2,3], [1.1, 2.3]).sum